showToast({title:'',type:1})
var app = new Vue({
    el: '#app',
    data: {
        state: 0, //0 全部 1 充电中 2已完成
        mescroll: null,
        list:[],
        pageNum:1,
        pageSize:10,
        load:false,
        showApp:false
    },
    mounted: function() {
        this.initmescroll();
    },
    methods: {
        tabToogle:function(index){
            this.state=index;
            this.mescroll.resetUpScroll(false);
        },
        callBackRefresh:function(){
            this.mescroll.resetUpScroll(false);
        },
        initmescroll:function(){
            var This = this;
            if(this.mescroll)return;
            this.mescroll = new MeScroll("mescroll", { 
                up: {
                    callback:This.upCallback, 
                    page: {
                        num: 0, 
                        size: 10 
                    },
                    htmlNodata: '<p class="upwarp-nodata">-- END --</p>',
                    noMoreSize: 5
                }
            });
            // this.mescroll.lockDownScroll(true);
        },
        upCallback:function(page){
            $ajax.post(apiUrl.orderlist,{
                type:this.state,
                offset: (page.num-1)*page.size,
                limit: page.size
            },function(res){
                if(page.num==1){
                    app.list=[];
                    showToast({title:'',type:2})
                }
                app.load=true;
                app.showApp=true;
                // console.log(res)
                app.mescroll.endSuccess(res.data.length);
                app.list=app.list.concat(res.data);
            })            
        },
        gotDetail: function(id,state) {
            // openChargingPage(id);
            if(!id){
                return ;
            }
            if(state==0){
                openChargingPage(id);
            }else{
                win_open(h5url+"/h5/chargingPile/orderDetail.html?id="+id,false,false);
            }
            
            // win_open("orderDetail.html?id="+id,false,false);
        },
    }

})